"use strict";
function swap(arr) {
    return [arr[1], arr[0]];
}
const s1 = swap([1, "a"]);
console.log(s1);
const s2 = swap([{ id: 1, name: "jack" }, "a"]);
console.log(s2);
const arr = [1, 2, 3, 4, 5];
function map(arr, callback) {
    const result = [];
    for (let i = 0; i < arr.length; i++) {
        const item = arr[i];
        result.push(callback(item, i));
    }
    return result;
}
const t1 = map(arr, (e) => e + 100);
const t2 = map(arr, (e) => `<span>index${e}</span>`);
console.log(t1, t2);
